package com.yc.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yc.entity.Commentsecord;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * InnoDB free: 4096 kB Mapper 接口
 * </p>
 *
 * @author ly
 * @since 2022-06-13
 */
public interface CommentsecordMapper extends BaseMapper<Commentsecord> {
    @Select("SELECT * from commentsecord where cmid=#{cmid} order by cmsdate desc")
    public List<Commentsecord> queryByCmid(Integer cmid);

    @Update("update commentsecord set praisenum=praisenum+1 where cmid=#{cmid} and uid=#{uid} and cmsid=#{cmsid}")
    public Integer addPraise(Integer cmid,Integer uid,Integer cmsid);

    @Update("update commentsecord set stampnum=stampnum+1 where cmid=#{cmid} and uid=#{uid} and cmsid=#{cmsid}")
    public Integer addStamp(Integer cmid, Integer uid, Integer cmsid);
}
